import request from './request'
import mockRequest from './mockRequest'
// 暴露一个被分装起来的axios 请求的方法
export const reqCategoryList = ()=>{
    return request({
        url:'/product/getBaseCategoryList',
        method:'get'
    })
}
export const reqGetBannerList = ()=>{
        return mockRequest({
            url:'/banner',
            method:'get'
        })
}
export const reqGetFloorList = ()=>{
        return mockRequest({
            url:'/floor',
            mathod:'get'
        })
}
export const reqGetSearchList = (data)=>{
    return request({
        url:'/list',
        method:'post',
        data
    })
}
export const reqGetDetailList =(skuId)=>{
    return request({
        url:`/item/${skuId}`,
        method:'get'
    })
} 
export const reqAddOrUpdateShopCart = (skuId,skuNum)=>{
    return request({
        url:`/cart/addToCart/${skuId}/${skuNum}`,
        method:'post'
    })
}
// 购物车axios的请求路径 /cart/cartList  请求时get请求
export const reqShopCartList = ()=>request({url:'/cart/cartList',method:'get'});
// 删除商品  /api/cart/deleteCart/{skuId}
export const reqdeleteCart = (skuId)=>{
        return request({
            url:`/cart/deleteCart/${skuId}`,
            method:'delete'
        })
}
// 切换商品选中的状态 /api/cart/checkCart/{skuID}/{isChecked}
export const reqCheckCart = (skuId,isChecked)=>{
    return request({
        url:`/cart/checkCart/${skuId}/${isChecked}`,
        method:'get'
    })
}
// 获取验证码 
// /api/user/passport/sendCode/{phone}
export const reqSendCode=(phone)=>{
    return request({
        url:`/user/passport/sendCode/${phone}`,
        method:'get'
    })
}
// 注册用户 /api/user/passport/register
export const reqRegister = (phone,code,password)=>{
    return request({
        url:'/user/passport/register',
        method:'post',
        data:{phone,code,password}
    })
}
// 用户登录
// /api/user/passport/login
export const reqLogin = (phone,password)=>{
    return request({
        url:'/user/passport/login',
        method:'post',
        data:{phone,password}
    })
}
// 获取用户信息 /api/user/passport/auth/getUserInfo
export const reqGetUserInfo = ()=>{
    return request({
        url:'/user/passport/auth/getUserInfo',
        method:'get',

    })
}
// 退出登录 /api/user/passport/logout
export const reqLogOut = ()=>{
    return request({
        url:'/user/passport/logout',
        method:'get'
    })
}
// 获取用户地址值
// /api/user/userAddress/auth/findUserAddressList
export const reqUserAddress = ()=>{
    return request({
        url:'/user/userAddress/auth/findUserAddressList',
        method:'get'
    })
}
// 获取订单页支付信息
// /api/order/auth/trade
export const reqTrade = ()=>{
    return request({
        url:'/order/auth/trade',
        method:'get'
    })
}
// 提交订单
// /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqSubmitOrder = (tradeNo,data)=>{
        return request({
            url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,
            method:'post',
            data
        })
}
// 获取订单的支付信息
// /api/payment/weixin/createNative/{orderId}
export const reqCreateNative = (orderId)=>{
    return request({
        url:`/payment/weixin/createNative/${orderId}`,
        method:'get',
    })
}
// 获取支付信息
// /api/payment/weixin/queryPayStatus/{orderId}\
export const reqPayStatus = (orderId)=>{
    return request({
        url:`/payment/weixin/queryPayStatus/${orderId}`,
        method:'get'
    })
}